package com.demo.controller;

import com.demo.entity.BookOrder;
import com.demo.service.IBookOrderService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProviderController {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("/bookOrder")
    public boolean bookOrder(@RequestBody BookOrder bookOrder){
        rabbitTemplate.convertAndSend("BookOrder","direct-queue-key",bookOrder);
        return true;
    }
}
